﻿CREATE TABLE [dbo].[BoardGameObjective]
(
	[BoardGameObjectiveId] INT NOT NULL identity(1,1),
	[BoardGameId] int not null,
	[BoardGameScenarioId] int null,
	[Name] nvarchar(128) not null,
	[objective_type] bit not null,
	[CreatedBy] NVARCHAR(256) NOT NULL, 
	[CreateDate] DATETIME NOT NULL, 
	[ModifiedBy] NVARCHAR(256) NOT NULL, 
	[ModifyDate] DATETIME NOT NULL, 
	constraint PK_BoardGameObjective primary key (BoardGameObjectiveId),
	constraint FK_BoardGameObjective_IsOf_BoardGame foreign key (BoardGameId)
		references BoardGame ([BoardGameId]),
	constraint FK_BoardGameObjective_IsOf_BoardGameScenario foreign key (BoardGameScenarioId)
		references BoardGameScenario (BoardGameScenarioId)
)
go
create unique index UX_BoardGameObjective_BoardGameId_BoardGameScenarioId_Name on BoardGameObjective (BoardGameId, BoardGameScenarioId, Name)
go
create index IX_BoardGameObjective_BoardGameId on BoardGameObjective (BoardGameId)
go
create index IX_BoardGameObjective_BoardGameScenarioId on BoardGameObjective (BoardGameScenarioId)
go
